home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / NDK / NDK_3.5 / Tutorials / ARexx / FunctionLibrary / Source / glue.a < prev    next >
Encoding:
Text File  |  1998-10-03  |  1.2 KB  |  42 lines

  1. *
  2. * $Id: glue.a 1.1 1997/06/25 18:46:44 olsen Exp $
  3. *
  4. * ARexx sample library
  5. *
  6. * :ts=8
  7. *
  8.  
  9.     section    text,code
  10.  
  11. *-----------------------------------------------------------------------------
  12.  
  13.     xdef    RexxDispatchGlue
  14.     xref    RexxDispatch
  15.  
  16. *-----------------------------------------------------------------------------
  17. *
  18. *    This "glue" routine is require since ARexx requires that the
  19. *    dispatcher returns result code and result string in registers
  20. *    D0 and A0 which the compiler cannot guarantee. So what we do
  21. *    is this: we make a little room on the stack for the result string
  22. *    and pass a pointer to this "room" in register A1. When the
  23. *    dispatcher has returned the result string is loaded into register
  24. *    A0 and control passes back to ARexx.
  25. *
  26. *-----------------------------------------------------------------------------
  27.  
  28. RexxDispatchGlue:
  29.  
  30.     clr.l    -(sp)        ; Make room for the result string and
  31.                 ; set it to zero
  32.     move.l    sp,a1        ; Load the address of the pointer into
  33.                 ; register A1
  34.     bsr    RexxDispatch    ; Invoke the real dispatcher
  35.  
  36.     move.l    (sp)+,a0    ; Load the result string into register A0
  37.     rts            ; And return to ARexx
  38.  
  39. *-----------------------------------------------------------------------------
  40.  
  41.     end
  42.